/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rpg;


import java.awt.Image;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import views.CharacterGraphics;

/**
 *
 * @author Emmanouil Samatas
 */
public abstract class GameCharacter {

    private String name;
    private int level;
    private int maxHealthPoints;
    private int maxManaPoints;
    private int healthPoints;
    private int manaPoints;
    protected int currentExperience;
     private CharacterGraphics characterGraphics;
    private int damage;
    private int defence;
    protected Map<String, Integer> attributes = new HashMap<>();
    protected String bigImageFileName;
    protected String smallImageFileName;
    protected ImageIcon characterBigImageIcon;
    protected Image characterImage;
    protected Image characterBigImage;

    public void attack(GameCharacter enemy) {
        int damageDone = GameCoreEngine.calculateDamage(this.damage, enemy.getDefence());
         enemy.giveDamage(damageDone);

    }
  
    
    
    public int getHealthPoints() {

        return healthPoints;
    }

    public void setHealthPoints(int hp) {
        this.healthPoints = hp;
    }

    public int getManaPoint() {
        return manaPoints;
    }

    public void setManaPoint(int mana) {
        this.manaPoints = mana;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getCharacterName() {
        return this.name;
    }

    public void setCharacterName(String name) {
        this.name = name;
    }

    public Map<String, Integer> getAttributes() {
        return this.attributes;
    }

    public void setAttributes(Map<String, Integer> attributes) {
        this.attributes = attributes;
    }

    public int getExperience() {
        return currentExperience;
    }

    public void setExperience(int experience) {
        this.currentExperience = experience;
    }

    public int getDamage() {
        return this.damage;
    }

    public void setDamage(int damage) {
        this.damage = damage;
    }

    public int getDefence() {
        return this.defence;
    }

    public int setDefence(int defence) {
        return this.defence = defence;
    }

    public Image getBigImage() {
        ImageIcon ii = new ImageIcon(this.getClass().getResource(bigImageFileName));
        characterBigImage = ii.getImage();
        return characterBigImage;

    }

    public Image getSmallImage() {
        ImageIcon ii = new ImageIcon(this.getClass().getResource(smallImageFileName));
        characterImage = ii.getImage();
        return characterImage;
    }

    public ImageIcon getBigImageIcon() {
        ImageIcon ii = new ImageIcon(this.getClass().getResource(bigImageFileName));
        return ii;
    }

    public int getMaxHealthPoints() {
        return this.maxHealthPoints;
    }

    public void setMaxHealthPoints(int maxHealthPoints) {
        this.maxHealthPoints = maxHealthPoints;
    }

    public int getMaxManaPoints() {
        return this.maxManaPoints;
    }

    public void setMaxManaPoints(int maxManaPoints) {
        this.maxManaPoints = maxManaPoints;
    }

    public void giveDamage(int damage) {
        if (this.healthPoints - damage < 0) {
            this.healthPoints = 0;
        } else {
            this.healthPoints -= damage;
        }
    }
    
    public CharacterGraphics getCharacterGraphics(){
        return this.characterGraphics;
    }
    
    public void setCharacterGraphics(CharacterGraphics characterGraphics){
        this.characterGraphics = characterGraphics;
    }
    public abstract void calculateCharacterProfile();
        


  
}
